package com.entity;

import java.text.ParseException;
import java.util.List;

import org.apache.struts.action.ActionForm;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.util.DateUtils;

/**
 * Rydd entity.
 * 
 * @author MyEclipse Persistence Tools
 */

public class Rydd extends ActionForm implements java.io.Serializable {

	// Fields

	private Integer id;
	private Ryzl ryzl;
	private Zd zdByDqbmbh;
	private Zd zdByDhzwbh;
	private Zd zdByDhbmbh;
	private Zd zdByDqzwbh;
	private Long ddrq;
	private String ddyy;
	private String bz;

	String ddrqString;
	
	String zdByDqbmbhString;
	String zdByDhzwbhString;
	String zdByDhbmbhString;
	String zdByDqzwbhString;
	// Constructors

	public String getDdrqString() {
		return DateUtils.DateToString(DateUtils.longToDate(ddrq));
	}
	/** default constructor */
	public Rydd() {
	}

	/** full constructor */
	public Rydd(Ryzl ryzl, Zd zdByDqbmbh, Zd zdByDhzwbh, Zd zdByDhbmbh,
			Zd zdByDqzwbh, Long ddrq, String ddyy, String bz) {
		this.ryzl = ryzl;
		this.zdByDqbmbh = zdByDqbmbh;
		this.zdByDhzwbh = zdByDhzwbh;
		this.zdByDhbmbh = zdByDhbmbh;
		this.zdByDqzwbh = zdByDqzwbh;
		this.ddrq = ddrq;
		this.ddyy = ddyy;
		this.bz = bz;
	}

	// Property accessors

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Ryzl getRyzl() {
		return this.ryzl;
	}

	public void setRyzl(Ryzl ryzl) {
		this.ryzl = ryzl;
	}

	public Zd getZdByDqbmbh() {
		return this.zdByDqbmbh;
	}

	public void setZdByDqbmbh(Zd zdByDqbmbh) {
		this.zdByDqbmbh = zdByDqbmbh;
	}

	public Zd getZdByDhzwbh() {
		return this.zdByDhzwbh;
	}

	public void setZdByDhzwbh(Zd zdByDhzwbh) {
		this.zdByDhzwbh = zdByDhzwbh;
	}

	public Zd getZdByDhbmbh() {
		return this.zdByDhbmbh;
	}

	public void setZdByDhbmbh(Zd zdByDhbmbh) {
		this.zdByDhbmbh = zdByDhbmbh;
	}

	public Zd getZdByDqzwbh() {
		return this.zdByDqzwbh;
	}

	public void setZdByDqzwbh(Zd zdByDqzwbh) {
		this.zdByDqzwbh = zdByDqzwbh;
	}

	public Long getDdrq() {
		return this.ddrq;
	}

	public void setDdrq(Long ddrq) {
		this.ddrq = ddrq;
	}

	public String getDdyy() {
		return this.ddyy;
	}

	public void setDdyy(String ddyy) {
		this.ddyy = ddyy;
	}

	public String getBz() {
		return this.bz;
	}

	public void setBz(String bz) {
		this.bz = bz;
	}
	public String getZdByDqbmbhString() {
		if(zdByDqbmbh!=null){
			String path=this.getClass().getResource("/").getPath();
			ApplicationContext ac = new  FileSystemXmlApplicationContext(path.substring(0, path.indexOf("classes"))+"applicationContext.xml");
			ZdDAO zdDAO=(ZdDAO)ac.getBean("ZdDAO");;
			Zd zd=zdDAO.findById(zdByDqbmbh.getId());
			//return zd.getTypename();
			return zd.getZdqc();
		}else{
			return zdByDqbmbhString;
		}
	}
	public void setZdByDqbmbhString(String zdByDqbmbhString) {
		this.zdByDqbmbhString = zdByDqbmbhString;
	}
	public String getZdByDhzwbhString() {
		if(zdByDhzwbh!=null){
			String path=this.getClass().getResource("/").getPath();
			ApplicationContext ac = new  FileSystemXmlApplicationContext(path.substring(0, path.indexOf("classes"))+"applicationContext.xml");
			ZdDAO zdDAO=(ZdDAO)ac.getBean("ZdDAO");
			Zd zd=zdDAO.findById(zdByDhzwbh.getId());
			return zd.getTypename();
		}else{
			return zdByDhzwbhString;
		}
	}
	public void setZdByDhzwbhString(String zdByDhzwbhString) {
		this.zdByDhzwbhString = zdByDhzwbhString;
	}
	public String getZdByDhbmbhString() {
		if(zdByDhbmbh!=null){
			String path=this.getClass().getResource("/").getPath();
			ApplicationContext ac = new  FileSystemXmlApplicationContext(path.substring(0, path.indexOf("classes"))+"applicationContext.xml");
			ZdDAO zdDAO=(ZdDAO)ac.getBean("ZdDAO");
			Zd zd=zdDAO.findById(zdByDhbmbh.getId());
			//return zd.getTypename();
			return zd.getZdqc();
		}else{
			return zdByDhbmbhString;
		}
	}
	public void setZdByDhbmbhString(String zdByDhbmbhString) {
		this.zdByDhbmbhString = zdByDhbmbhString;
	}
	public String getZdByDqzwbhString() {
		if(zdByDqzwbh!=null){
			String path=this.getClass().getResource("/").getPath();
			ApplicationContext ac = new  FileSystemXmlApplicationContext(path.substring(0, path.indexOf("classes"))+"applicationContext.xml");
			ZdDAO zdDAO=(ZdDAO)ac.getBean("ZdDAO");
			Zd zd=zdDAO.findById(zdByDqzwbh.getId());
			return zd.getTypename();
		}else{
			return zdByDqzwbhString;
		}
	}
	public void setZdByDqzwbhString(String zdByDqzwbhString) {
		this.zdByDqzwbhString = zdByDqzwbhString;
	}
	public void setDdrqString(String ddrqString) {
		this.ddrqString = ddrqString;
		try {
			this.ddrq=DateUtils.stringToLong(ddrqString);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}